import 'package:architecture/os_size.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../widgets/text_button.dart';
import '../../widgets/yz_text.dart';
import 'query_board_code_controller.dart';

class QueryBoardCodePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetBuilder<QueryBoardCodeController>(
        init: QueryBoardCodeController(),
        builder: (controller) {
          return Scaffold(
            appBar: AppBar(title: Text('查询棋盘编号')),
            body: Container(
                height: 80,
                margin: EdgeInsets.only(left: 15),
                child: Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Container(
                          width: windowWidth * 0.4,
                          margin: EdgeInsets.only(right: 15),
                          child: MyTextField(
                            controller: controller.textEditingController,
                            hintText: '请输入对局id',
                          )),
                      _textButton('查询', onPressed: () {
                        controller.queryBoardCode();
                      }),
                    ])),
          );
        });
  }

  _textButton(String text, {Function? onPressed}) {
    return Container(
        margin: EdgeInsets.only(left: 15, right: 20),
        alignment: Alignment.center,
        child: MyTextButton(
            text: text,
            confirm: () {
              onPressed?.call();
            },
            backgroundColor: Colors.deepPurpleAccent,
            textStyle: TextStyle(color: Colors.white)));
  }
}
